//     https://ac.nowcoder.com/acm/problem/214850




#include <iostream>
using namespace std;

char s[105][55];

int aba(char a[], char b[])
{
    for (int i = 0; a[i]; i++)
        for (int j = 0; b[j]; j++)
            if (a[i] == b[j])  return 1;
    return 0;
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, k = 1;
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> s[i];
        int l = 1, r = n;
        while (l < r)
        {
            if (aba(s[l], s[r]) == 0)  k = 0;
            l++;
            r--;
        }
        if (!k) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}